package cn.sczc.jh.client.controller.option;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.sczc.jh.client.entity.User;

@Controller
@RequestMapping({ "/option/map" })
public class MapViewController {
	/**
	 * 井队在地图中的数据维护
	 * @param model
	 * @return
	 */
	@GetMapping("/team")
	public String team(Model model) {
		Subject subject = SecurityUtils.getSubject();
		User user = (User) subject.getPrincipal();
		model.addAttribute("permissionList",user.getPermissions());
		model.addAttribute("userId", user.getId().toString());
		model.addAttribute("tenantId", user.getTenantId().toString());
		model.addAttribute("userName", user.getUsername());
		model.addAttribute("teamList", user.getTeams());
		return "option/map/team";
	}
	
	/**
	 * 井口图像在地图中的维护
	 * @param model
	 * @return
	 */
	@GetMapping("/well")
	public String well(Model model) {
		Subject subject = SecurityUtils.getSubject();
		User user = (User) subject.getPrincipal();
		model.addAttribute("permissionList",user.getPermissions());
		model.addAttribute("userId", user.getId().toString());
		model.addAttribute("tenantId", user.getTenantId().toString());
		model.addAttribute("userName", user.getUsername());
		model.addAttribute("teamList", user.getTeams());
		return "option/map/well";
	}
}
